
#ifndef _READWRITE_3DS_H_
#define _READWRITE_3DS_H_

#include <BFile>
#include <BNode>
#include <BReadWrite>

#include "MateStl.h"
#include "MeshStl.h"

using namespace BWE;

class ReadWrite_stl : public BReadWrite
{
public:
	ReadWrite_stl();
	~ReadWrite_stl();

	virtual void setOptions(const BString& options) override;
	virtual const BString& options() const override;

	virtual BObject* load(const BString& fileName) override;
	virtual bool load(const BString& fileName, BObject* object) override;
	virtual bool save(const BString& fileName, const BObject* object) const override;

	virtual BObject* read(const BBuffer& buffer) override;
	virtual bool read(const BBuffer& buffer, BObject* object) override;
	virtual bool write(BBuffer& buffer, const BObject* object) const override;

	virtual const BString& author() const;
	virtual const BString& version() const;
	virtual const BString& description() const;
	virtual const BString& message() const;

private:
	MateStl* findMaterial(const BString& matName);

private:
	mutable BFile			_file;
	BList<MateStlHolder>	_mates;
	BList<MeshStlHolder>	_geoms;

	BString			_author;
	BString			_version;
	BString			_description;
	BString			_message;
	BString			_options;
	BString			_log;
};

#endif